home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / Fonts.p < prev    next >
Text File  |  1996-05-01  |  13KB  |  422 lines

  1. {
  2.      File:        Fonts.p
  3.  
  4.      Contains:    Font Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT Fonts;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __FONTS__}
  28. {$SETC __FONTS__ := 1}
  29.  
  30. {$I+}
  31. {$SETC FontsIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __GXTYPES__}
  35. {$I GXTypes.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __QUICKDRAW__}
  38. {$I Quickdraw.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __TEXTCOMMON__}
  41. {$I TextCommon.p}
  42. {$ENDC}
  43.  
  44. {$PUSH}
  45. {$ALIGN MAC68K}
  46. {$LibExport+}
  47.  
  48.  
  49. CONST
  50.     systemFont                    = 0;
  51.     applFont                    = 1;
  52.     newYork                        = 2;
  53.     geneva                        = 3;
  54.     monaco                        = 4;
  55.     venice                        = 5;
  56.     london                        = 6;
  57.     athens                        = 7;
  58.     sanFran                        = 8;
  59.     toronto                        = 9;
  60.     cairo                        = 11;
  61.     losAngeles                    = 12;
  62.     times                        = 20;
  63.     helvetica                    = 21;
  64.     courier                        = 22;
  65.     symbol                        = 23;
  66.     mobile                        = 24;
  67.     commandMark                    = 17;
  68.     checkMark                    = 18;
  69.     diamondMark                    = 19;
  70.  
  71.     appleMark                    = 20;
  72.     propFont                    = 36864;
  73.     prpFntH                        = 36865;
  74.     prpFntW                        = 36866;
  75.     prpFntHW                    = 36867;
  76.     fixedFont                    = 45056;
  77.     fxdFntH                        = 45057;
  78.     fxdFntW                        = 45058;
  79.     fxdFntHW                    = 45059;
  80.     fontWid                        = 44208;
  81.  
  82.  
  83. TYPE
  84.     FMInputPtr = ^FMInput;
  85.     FMInput = PACKED RECORD
  86.         family:                    INTEGER;
  87.         size:                    INTEGER;
  88.         face:                    Style;
  89.         needBits:                BOOLEAN;
  90.         device:                    INTEGER;
  91.         numer:                    Point;
  92.         denom:                    Point;
  93.     END;
  94.  
  95. {
  96.  #pragma output c
  97.  typedef struct OpaquePrivateFontResult *privateFontResult;
  98.  #pragma output pascal
  99.  typedef Ptr privateFontResult;
  100.  #pragma output all
  101. }
  102.     FontResult = ^LONGINT;
  103.     FMOutputPtr = ^FMOutput;
  104.     FMOutput = PACKED RECORD
  105.         errNum:                    INTEGER;
  106.         fontResult:                FontResult;
  107.         boldPixels:                UInt8;
  108.         italicPixels:            UInt8;
  109.         ulOffset:                UInt8;
  110.         ulShadow:                UInt8;
  111.         ulThick:                UInt8;
  112.         shadowPixels:            UInt8;
  113.         extra:                    SInt8;
  114.         ascent:                    UInt8;
  115.         descent:                UInt8;
  116.         widMax:                    UInt8;
  117.         leading:                SInt8;
  118.         curStyle:                SInt8;
  119.         numer:                    Point;
  120.         denom:                    Point;
  121.     END;
  122.  
  123.     FMOutPtr                            = ^FMOutput;
  124.     FontRecPtr = ^FontRec;
  125.     FontRec = RECORD
  126.         fontType:                INTEGER;                                { font type }
  127.         firstChar:                INTEGER;                                { ASCII code of first character }
  128.         lastChar:                INTEGER;                                { ASCII code of last character }
  129.         widMax:                    INTEGER;                                { maximum character width }
  130.         kernMax:                INTEGER;                                { negative of maximum character kern }
  131.         nDescent:                INTEGER;                                { negative of descent }
  132.         fRectWidth:                INTEGER;                                { width of font rectangle }
  133.         fRectHeight:            INTEGER;                                { height of font rectangle }
  134.         owTLoc:                    INTEGER;                                { offset to offset/width table }
  135.         ascent:                    INTEGER;                                { ascent }
  136.         descent:                INTEGER;                                { descent }
  137.         leading:                INTEGER;                                { leading }
  138.         rowWords:                INTEGER;                                { row width of bit image / 2  }
  139.     END;
  140.  
  141.     FMetricRecPtr = ^FMetricRec;
  142.     FMetricRec = RECORD
  143.         ascent:                    Fixed;                                    { base line to top }
  144.         descent:                Fixed;                                    { base line to bottom }
  145.         leading:                Fixed;                                    { leading between lines }
  146.         widMax:                    Fixed;                                    { maximum character width }
  147.         wTabHandle:                Handle;                                    { handle to font width table }
  148.     END;
  149.  
  150. {
  151.  typedef struct FMetricRec FMetricRec, *FMetricRecPtr;
  152.  typedef FMetricRecPtr *FMetricRecHandle;
  153. }
  154.     FMetricRecHandle                    = ^FMetricRecPtr;
  155.     WidEntryPtr = ^WidEntry;
  156.     WidEntry = RECORD
  157.         widStyle:                INTEGER;                                { style entry applies to }
  158.     END;
  159.  
  160.     WidTablePtr = ^WidTable;
  161.     WidTable = RECORD
  162.         numWidths:                INTEGER;                                { number of entries - 1 }
  163.     END;
  164.  
  165.     AsscEntryPtr = ^AsscEntry;
  166.     AsscEntry = RECORD
  167.         fontSize:                INTEGER;
  168.         fontStyle:                INTEGER;
  169.         fontID:                    INTEGER;                                { font resource ID }
  170.     END;
  171.  
  172.     FontAssocPtr = ^FontAssoc;
  173.     FontAssoc = RECORD
  174.         numAssoc:                INTEGER;                                { number of entries - 1 }
  175.     END;
  176.  
  177.     StyleTablePtr = ^StyleTable;
  178.     StyleTable = RECORD
  179.         fontClass:                INTEGER;
  180.         offset:                    LONGINT;
  181.         reserved:                LONGINT;
  182.         indexes:                PACKED ARRAY [0..47] OF CHAR;
  183.     END;
  184.  
  185.     NameTablePtr = ^NameTable;
  186.     NameTable = RECORD
  187.         stringCount:            INTEGER;
  188.         baseFontName:            Str255;
  189.     END;
  190.  
  191.     KernPairPtr = ^KernPair;
  192.     KernPair = RECORD
  193.         kernFirst:                SInt8;                                    { 1st character of kerned pair }
  194.         kernSecond:                SInt8;                                    { 2nd character of kerned pair }
  195.         kernWidth:                INTEGER;                                { kerning in 1pt fixed format }
  196.     END;
  197.  
  198.     KernEntryPtr = ^KernEntry;
  199.     KernEntry = RECORD
  200.         kernStyle:                INTEGER;                                { style the entry applies to }
  201.         kernLength:                INTEGER;                                { length of this entry }
  202.     END;
  203.  
  204.     KernTablePtr = ^KernTable;
  205.     KernTable = RECORD
  206.         numKerns:                INTEGER;                                { number of kerning entries }
  207.     END;
  208.  
  209.     WidthTablePtr = ^WidthTable;
  210.     WidthTable = PACKED RECORD
  211.         tabData:                ARRAY [0..255] OF Fixed;                { character widths }
  212.         fontResult:                FontResult;                                { font record used to build table }
  213.         sExtra:                    LONGINT;                                { space extra used for table }
  214.         style:                    LONGINT;                                { extra due to style }
  215.         fID:                    INTEGER;                                { font family ID }
  216.         fSize:                    INTEGER;                                { font size request }
  217.         face:                    INTEGER;                                { style (face) request }
  218.         device:                    INTEGER;                                { device requested }
  219.         inNumer:                Point;                                    { scale factors requested }
  220.         inDenom:                Point;                                    { scale factors requested }
  221.         aFID:                    INTEGER;                                { actual font family ID for table }
  222.         fHand:                    Handle;                                    { family record used to build up table }
  223.         usedFam:                BOOLEAN;                                { used fixed point family widths }
  224.         aFace:                    UInt8;                                    { actual face produced }
  225.         vOutput:                INTEGER;                                { vertical scale output value }
  226.         hOutput:                INTEGER;                                { horizontal scale output value }
  227.         vFactor:                INTEGER;                                { vertical scale output value }
  228.         hFactor:                INTEGER;                                { horizontal scale output value }
  229.         aSize:                    INTEGER;                                { actual size of actual font used }
  230.         tabSize:                INTEGER;                                { total size of table }
  231.     END;
  232.  
  233.     FamRecPtr = ^FamRec;
  234.     FamRec = RECORD
  235.         ffFlags:                INTEGER;                                { flags for family }
  236.         ffFamID:                INTEGER;                                { family ID number }
  237.         ffFirstChar:            INTEGER;                                { ASCII code of 1st character }
  238.         ffLastChar:                INTEGER;                                { ASCII code of last character }
  239.         ffAscent:                INTEGER;                                { maximum ascent for 1pt font }
  240.         ffDescent:                INTEGER;                                { maximum descent for 1pt font }
  241.         ffLeading:                INTEGER;                                { maximum leading for 1pt font }
  242.         ffWidMax:                INTEGER;                                { maximum widMax for 1pt font }
  243.         ffWTabOff:                LONGINT;                                { offset to width table }
  244.         ffKernOff:                LONGINT;                                { offset to kerning table }
  245.         ffStylOff:                LONGINT;                                { offset to style mapping table }
  246.         ffProperty:                ARRAY [0..8] OF INTEGER;                { style property info }
  247.         ffIntl:                    ARRAY [0..1] OF INTEGER;                { for international use }
  248.         ffVersion:                INTEGER;                                { version number }
  249.     END;
  250.  
  251.     FontPointSize                        = SInt16;
  252.     FontFamilyID                        = SInt16;
  253. PROCEDURE InitFonts;
  254.     {$IFC NOT GENERATINGCFM}
  255.     INLINE $A8FE;
  256.     {$ENDC}
  257. PROCEDURE GetFontName(familyID: INTEGER; VAR name: Str255);
  258.     {$IFC NOT GENERATINGCFM}
  259.     INLINE $A8FF;
  260.     {$ENDC}
  261. PROCEDURE GetFNum(name: Str255; VAR familyID: INTEGER);
  262.     {$IFC NOT GENERATINGCFM}
  263.     INLINE $A900;
  264.     {$ENDC}
  265. FUNCTION RealFont(fontNum: INTEGER; size: INTEGER): BOOLEAN;
  266.     {$IFC NOT GENERATINGCFM}
  267.     INLINE $A902;
  268.     {$ENDC}
  269. PROCEDURE SetFontLock(lockFlag: BOOLEAN);
  270.     {$IFC NOT GENERATINGCFM}
  271.     INLINE $A903;
  272.     {$ENDC}
  273. FUNCTION FMSwapFont({CONST}VAR inRec: FMInput): FMOutPtr;
  274.     {$IFC NOT GENERATINGCFM}
  275.     INLINE $A901;
  276.     {$ENDC}
  277. PROCEDURE SetFScaleDisable(fscaleDisable: BOOLEAN);
  278.     {$IFC NOT GENERATINGCFM}
  279.     INLINE $A834;
  280.     {$ENDC}
  281. PROCEDURE FontMetrics(theMetrics: FMetricRecPtr);
  282.     {$IFC NOT GENERATINGCFM}
  283.     INLINE $A835;
  284.     {$ENDC}
  285. PROCEDURE SetFractEnable(fractEnable: BOOLEAN);
  286.     {$IFC NOT GENERATINGCFM}
  287.     INLINE $A814;
  288.     {$ENDC}
  289. FUNCTION GetDefFontSize: INTEGER;
  290.     {$IFC NOT GENERATINGCFM}
  291.     INLINE $3EB8, $0BA8, $6604, $3EBC, $000C;
  292.     {$ENDC}
  293. FUNCTION IsOutline(numer: Point; denom: Point): BOOLEAN;
  294.     {$IFC NOT GENERATINGCFM}
  295.     INLINE $7000, $A854;
  296.     {$ENDC}
  297. PROCEDURE SetOutlinePreferred(outlinePreferred: BOOLEAN);
  298.     {$IFC NOT GENERATINGCFM}
  299.     INLINE $7001, $A854;
  300.     {$ENDC}
  301. FUNCTION GetOutlinePreferred: BOOLEAN;
  302.     {$IFC NOT GENERATINGCFM}
  303.     INLINE $7009, $A854;
  304.     {$ENDC}
  305. FUNCTION OutlineMetrics(byteCount: INTEGER; textPtr: UNIV Ptr; numer: Point; denom: Point; VAR yMax: INTEGER; VAR yMin: INTEGER; awArray: FixedPtr; lsbArray: FixedPtr; boundsArray: RectPtr): OSErr;
  306.     {$IFC NOT GENERATINGCFM}
  307.     INLINE $7008, $A854;
  308.     {$ENDC}
  309. PROCEDURE SetPreserveGlyph(preserveGlyph: BOOLEAN);
  310.     {$IFC NOT GENERATINGCFM}
  311.     INLINE $700A, $A854;
  312.     {$ENDC}
  313. FUNCTION GetPreserveGlyph: BOOLEAN;
  314.     {$IFC NOT GENERATINGCFM}
  315.     INLINE $700B, $A854;
  316.     {$ENDC}
  317. FUNCTION FlushFonts: OSErr;
  318.     {$IFC NOT GENERATINGCFM}
  319.     INLINE $700C, $A854;
  320.     {$ENDC}
  321. FUNCTION GetSysFont: INTEGER;
  322.     {$IFC NOT GENERATINGCFM}
  323.     INLINE $3EB8, $0BA6;
  324.     {$ENDC}
  325. FUNCTION GetAppFont: INTEGER;
  326.     {$IFC NOT GENERATINGCFM}
  327.     INLINE $3EB8, $0984;
  328.     {$ENDC}
  329. {$IFC FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
  330. PROCEDURE AntiTextSetApplicationAware(aware: BOOLEAN);
  331.     {$IFC NOT GENERATINGCFM}
  332.     INLINE $7024, $A854;
  333.     {$ENDC}
  334. FUNCTION AntiTextGetApplicationAware: BOOLEAN;
  335.     {$IFC NOT GENERATINGCFM}
  336.     INLINE $7025, $A854;
  337.     {$ENDC}
  338. PROCEDURE AntiTextSetEnabled(enabled: BOOLEAN);
  339.     {$IFC NOT GENERATINGCFM}
  340.     INLINE $7026, $A854;
  341.     {$ENDC}
  342. FUNCTION AntiTextGetEnabled: BOOLEAN;
  343.     {$IFC NOT GENERATINGCFM}
  344.     INLINE $7027, $A854;
  345.     {$ENDC}
  346. FUNCTION AntiTextIsAntiAliased(numer: Point; denom: Point): BOOLEAN;
  347.     {$IFC NOT GENERATINGCFM}
  348.     INLINE $7028, $A854;
  349.     {$ENDC}
  350. {$ENDC}
  351. {$IFC FOR_SYSTEM8_COOPERATIVE }
  352.  
  353. CONST
  354.     kSystemSpecialFont            = 1;
  355.     kApplicationSpecialFont        = 2;
  356.     kSmallSystemSpecialFont        = 3;
  357.     kEmphasisSpecialFont        = 4;
  358.     kKeyboardSymbolSpecialFont    = 5;
  359.     kCountSpecialFonts            = 5;
  360.  
  361.  
  362. TYPE
  363.     SpecialFontSelector                    = UInt32;
  364. {  -------------------------------------------------------------- }
  365.     TextStrikeRef = ^LONGINT;
  366.  
  367. CONST
  368.     kDefaultTextStrike            = 0;
  369.     kAntiAliasTextStrike        = $0001;
  370.     kFractionalWidthsTextStrike    = $0002;
  371.     kPreserveGlyphTextStrike    = $0004;
  372.  
  373.     kPreserveTextStrikeElement    = $8000;                        {  for QDSetStrikeElements  }
  374.  
  375.  
  376. TYPE
  377.     TextStrikeOption                    = OptionBits;
  378. {  -------------------------------------------------------------- }
  379. FUNCTION QDNewStrike: TextStrikeRef; C;
  380. PROCEDURE QDDisposeStrike(strike: TextStrikeRef); C;
  381. FUNCTION QDCloneStrike(strike: TextStrikeRef): TextStrikeRef; C;
  382. FUNCTION QDCopyStrike(source: TextStrikeRef): TextStrikeRef; C;
  383. PROCEDURE QDReplaceStrike(destination: TextStrikeRef; source: TextStrikeRef); C;
  384. FUNCTION QDEqualStrike(strike1: TextStrikeRef; strike2: TextStrikeRef): BOOLEAN; C;
  385. FUNCTION QDStrikeOwnerCount(strike: TextStrikeRef): ItemCount; C;
  386. FUNCTION QDFlattenStrike(strike: TextStrikeRef; VAR stream: Byte): ByteCount; C;
  387. FUNCTION QDUnflattenStrike(strike: TextStrikeRef; {CONST}VAR stream: Byte; VAR size: ByteCount): TextStrikeRef; C;
  388. PROCEDURE QDGetStrikeElements(strike: TextStrikeRef; VAR familyID: INTEGER; VAR styleBits: INTEGER; VAR pointSize: INTEGER); C;
  389. PROCEDURE QDSetStrikeElements(strike: TextStrikeRef; familyID: INTEGER; styleBits: INTEGER; pointSize: INTEGER); C;
  390. FUNCTION QDGetStrikeOptions(strike: TextStrikeRef): TextStrikeOption; C;
  391. PROCEDURE QDSetStrikeOptions(strike: TextStrikeRef; options: TextStrikeOption); C;
  392. FUNCTION QDGetStrikeSpecialFont(strike: TextStrikeRef): SpecialFontSelector; C;
  393. PROCEDURE QDSetStrikeSpecialFont(strike: TextStrikeRef; selector: SpecialFontSelector); C;
  394. FUNCTION QDGetStrikeEncoding(strike: TextStrikeRef): TextEncoding; C;
  395. PROCEDURE QDSetStrikeEncoding(strike: TextStrikeRef; encoding: TextEncoding); C;
  396. FUNCTION QDGetStrikeFeatures(strike: TextStrikeRef; VAR features: gxRunFeature): ItemCount; C;
  397. PROCEDURE QDSetStrikeFeatures(strike: TextStrikeRef; count: ItemCount; {CONST}VAR features: gxRunFeature); C;
  398. FUNCTION QDGetStrikeVariations(strike: TextStrikeRef; VAR variations: gxFontVariation): ItemCount; C;
  399. PROCEDURE QDSetStrikeVariations(strike: TextStrikeRef; count: ItemCount; {CONST}VAR variations: gxFontVariation); C;
  400. FUNCTION QDGetStrikeMapping(strike: TextStrikeRef; VAR map: gxMapping): gxMappingPtr; C;
  401. PROCEDURE QDSetStrikeMapping(strike: TextStrikeRef; {CONST}VAR map: gxMapping); C;
  402. FUNCTION QDGetPortStrike(VAR port: CGrafPort): TextStrikeRef; C;
  403. PROCEDURE QDSetPortStrike(VAR port: CGrafPort; strike: TextStrikeRef); C;
  404. FUNCTION QDGetStrikeCustomItem(strike: TextStrikeRef; tag: OSType; dataP: BytePtr): ByteCount; C;
  405. PROCEDURE QDSetStrikeCustomItem(strike: TextStrikeRef; tag: OSType; dataP: BytePtr; size: ByteCount); C;
  406. PROCEDURE QDSetStrikeColors(strike: TextStrikeRef; VAR foreColor: RGBColor; VAR backColor: RGBColor); C;
  407. PROCEDURE QDGetStrikeColors(strike: TextStrikeRef; VAR foreColor: RGBColor; VAR backColor: RGBColor); C;
  408. PROCEDURE QDSetStrikeTransferMode(strike: TextStrikeRef; textMode: INTEGER); C;
  409. FUNCTION QDGetStrikeTransferMode(strike: TextStrikeRef): INTEGER; C;
  410. {  -------------------------------------------------------------- }
  411. {$ENDC}
  412. {$ALIGN RESET}
  413. {$POP}
  414.  
  415. {$SETC UsingIncludes := FontsIncludes}
  416.  
  417. {$ENDC} {__FONTS__}
  418.  
  419. {$IFC NOT UsingIncludes}
  420.  END.
  421. {$ENDC}
  422.